﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Cinemax.DTO;
using Cinemax.BUS;
using Cinemax.DAO;

namespace Cinemax.Ajax
{
    public partial class ajax_film_schedule : System.Web.UI.Page
    {
        public List<List<SuatChieuDTO>> lsc_f = new List<List<SuatChieuDTO>>();
        public List<string> lstPhim = new List<string>();
        public List<PhimDTO> listPhim = new List<PhimDTO>();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["ngay"] == null)
            {
                Response.Redirect("home.aspx");
            }
            int ngay = int.Parse(Request.QueryString["ngay"]);
            string url = Request.QueryString["phim"].Replace("%2c", ",");
            lstPhim = url.Split(',').ToList();

            switch (ngay)
            {
                case 1:
                    {
                        foreach (string item in lstPhim)
                        {
                            if (item != "")
                            {
                                List<SuatChieuDTO> lsc = new List<SuatChieuDTO>();
                                DateTime temp = DateTime.Now;
                                //lsc = SuatChieuBUS.getSuatChieuHomNay(int.Parse(item), DateTime.Now);
                                lsc = SuatChieuBUS.getSuatChieuHomNay(int.Parse(item), temp);
                                lsc_f.Add(lsc);
                                PhimDTO phim = PhimDAO.getPhimByID(int.Parse(item));
                                listPhim.Add(phim);
                            }

                        }

                        break;
                    }
            }

        }
    }
}